//#include <iostream>
//#include <string>
////using namespace std;
////
////// 复习C++继承知识
////
////class Base
////{
////
////    // 友元关系不能继承
////    friend ostream& operator<<(ostream& out,Base& b);
////    friend ostream& operator<<(ostream& out, const Base& b);
////
////protected:
////    int _age;
////    string _name;
////public:
////
////    // 静态成员---子类与父类一样，与父类共有
////    static int a;
////
////    // 构造
////    Base(const int& age,const string& name)
////        : _age(age)
////        ,_name(name)
////    {
////        cout << "Base(const int& age,const string& name)" << endl;
////
////    }
////    //// 默认构造
////    //Base()
////    //  :_age(int())
////    //  ,_name(string())
////    //{
////
////    //}
////
////    // 拷贝构造
////    Base(const Base& b)
////        :_age(b._age)
////        ,_name(b._name)
////    {
////        cout << "Base(const Base & b)" << endl;
////    }
////    Base& operator=(const Base& b)
////    {
////        cout << "Base& operator=(const Base& b)" << endl;
////        if (this != &b)
////        {
////            _age = b._age;
////            _name = b._name;
////        }
////
////        return *this;
////    }
////    ~Base()
////    {
////        cout << "~Base" << endl;
////    }
////
////};
////
////int Base::a = 0;
////
////// 三种继承方式public，protected，private
////
////class Derive :public Base
////{
////private:
////    int _id;
////public:
////    // 如果父类有默认的构造函数，则子类可以不用帮助父类构造
////    // 如果父类没有默认的构造函数，则子类一定需要帮助父类进行构造
////    // 也就是说必须要调用到父类的构造函数进行初始化
////    Derive(const int& age, const string& name, const int& id)
////        :Base(age,name)
////        ,_id(id)
////    {
////
////    }
////
////    // 拷贝构造
////    // 如果子类没有写拷贝构造，则编译器会对内置类型进行值拷贝，自定义类型调用对应的拷贝构造，还会调用父类的拷贝构造
////    // 如果子类写了拷贝构造，自己必须要显示调用父类的拷贝构造切片，内置类型与自定义类型进行拷贝构造调用
////    Derive(const Derive& d)
////        :Base(d)
////        ,_id(d._age)
////    {
////
////    }
////    // 可以不建议，因为调用的是父类的构造，而不是父类的拷贝构造
////    /*Derive(const Derive& d)
////        :Base(d._age,d._name)
////        , _id(d._age)
////    {
////
////    }*/
////
////    // 赋值重载 --- 与拷贝构造相同
////    Derive& operator=(const Derive& d)
////    {
////        if (this != &d)
////        {
////            Base::operator=(d);
////            _id = d._id;
////        }
////        return *this;
////    }
////
////    // 子类的析构函数，内置类型不处理，自定义类型调用对应的析构函数，还会自动调用父类的析构函数
////    // 子类自动调用父类的析构函数---保证父类构造-》子类构造-》子类析构-》父类析构
////    // 由于多态的原因，子类与父类的析构函数构成同名隐藏
////    ~Derive()
////    {
////        cout << "~Derive()" << endl;
////    }
////
////    // 取地址重载无须处理，最主要是理解子类赋值给父类的切片行为
////
////};
////
////
//////class AA
//////{
//////public:
//////  ~AA()
//////  {
//////      cout << "~AA()" << endl;
//////  }
//////};
//////
//////class BB
//////{
//////private:
//////  AA _aa;
//////
//////public:
//////  ~BB()
//////  {
//////
//////  }
//////
//////};
//////
//////ostream& operator<<(ostream& out, Base& b)
//////{
//////  /*out << b._age << " " << b._name <<((Derive)b)._id <<endl;*/
//////  out << b._age << " " << b._name << endl;
//////
//////  return out;
//////}
////
//////ostream& operator<<(ostream& out, const Derive& d)
//////{
//////  out << d._age << " " << d._name << d._id << endl;
//////
//////  return out;
//////}
////
//////int main()
//////{
//////  Base b(18, "zhangsan");
//////  Derive d(18,"zhangsan",1);
//////  
//////  cout << Derive::a << endl;
//////
//////  cout << ++Base::a << endl;
//////  cout << Derive::a << endl;
//////
//////  //Base b(18, "zhangsan");
//////  //cout << b;
//////
//////  //Derive d(18,"zhangsan",1);
//////
//////  //Derive copy = d;
//////  //
//////  //d = copy;
//////
//////  //BB b;
//////
//////  return 0;
//////}
////
////// 理解切片
////class Base1
////{
////
////};
////
////class Base2
////{
////
////};
////
////class Child : public Base1, public Base2
////{
////
////};
////
////int main(int argc, char* argv[], char* env[])
////{
////    Child c;
////
////    Base1* p1 = &c;
////    Base2* p2 = &c;
////    Child* p3 = &c;
////
////
////    /*for (int i = 0; i < argc; i++)
////    {
////        cout << argv[i] << endl;
////    }
////    cout << endl;
////
////    for (int i = 0; env[i] != NULL; i++)
////    {
////        cout << env[i] << endl;
////    }*/
////
////    return 0;
////}
